<?php namespace Admin\Controller;
//站点配置
class ConfigController extends CommonController{
	private $model;
	public function __auto(){
	    $this->model=new \Admin\Model\WebSet;
	}
	public function index(){
		//2)修改数局库的信息
		if(IS_POST){
			foreach(Q('post.') as $k=>$v){
				$this->model->where("name='{$k}'")->save(array('value'=>$v));
			}
			//修改配置项文件
			file_put_contents('./Config/webSet.php', "<?php\r\nreturn " . var_export(Q('post.'),true) . ";");
			View::success('修改成功');
		}	
		
		//1)显示配置数据
		$data=$this->model->get();
//		p($data);
		View::with('data',$data);
	    View::make();
	}
	
	
	
	
}
 ?>